package com.hp.response;


import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * 统一返回response
 *
 * @author hp
 */
@Getter
@Setter
public class ServiceResponse<T> implements Serializable {

    /**
     * 0:成功 1:失败
     */
    private String code;

    /**
     * SUCCESS | FAIL
     */
    private String message;

    private T data;

    public String getCode() {
        return code;
    }

    public ServiceResponse<T> setCode(String code) {
        this.code = code;
        return this;
    }

    public String getMessage() {
        return message;
    }

    public ServiceResponse<T> setMessage(String message) {
        this.message = message;
        return this;
    }

    public T getData() {
        return data;
    }

    public ServiceResponse<T> setData(T data) {
        this.data = data;
        return this;
    }

    @Override
    public String toString() {
        return "ServiceResponse{" + "code='" + code + '\'' + ", message='" + message + '\'' + ", data=" + data
                + '}';
    }
}

